package com.palm.hubo2o.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;

import com.palm.hubo2o.adapter.HisIssueAdapter;
import com.palm.hubo2o.ui.fragment.LotteryFragment;
import com.palm.hubo2o.ui.fragment.QLCBankerFragment;
import com.palm.hubo2o.ui.fragment.QLCNormFragment;
import com.palm.hubo2o.util.EnumCode;


/**
 * Created by dest1 on 2015/10/13.
 */
public class QLCLotteryActivity extends LotteryActivity {
    private LotteryFragment qlcNorm;
    private LotteryFragment qlcBanker;
    private HisIssueAdapter adapter;

    @NonNull
    @Override
    protected EnumCode.gameId gameId() {
        return EnumCode.gameId.QLC;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        qlcNorm = new QLCNormFragment();
        qlcNorm.setTitle("普通");
        qlcBanker = new QLCBankerFragment();
        qlcBanker.setTitle("胆拖");
        setFragments(qlcNorm, qlcBanker);
        handleLimitPick(getIntent());
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        handleLimitPick(intent);
    }

    private void handleLimitPick(Intent intent) {
        EnumCode.PlayType playType = (EnumCode.PlayType) intent.getSerializableExtra(EnumCode.PlayType.class.getName());
        if (playType != null) {
            switch (playType) {
                case QLC_DS:
                case QLC_FS:
                    vp.setEnabled(false);
                    tab.getTabAt(0).select();
                    tab.setVisibility(View.GONE);
                    break;
                case QLC_DT:
                    vp.setEnabled(false);
                    tab.getTabAt(1).select();
                    tab.setVisibility(View.GONE);
                    break;
                default:
                    break;
            }

        }
    }

}
